# address of memory to store sp
.equ SPMADR, 0x90004000

# string
test_start_str:
    .string "\n--- security_function() start ---\r\n"

test_end_str:
    .string "\n--- security_function() end ---\r\n"

test_handler_str:
    .string "MTimer IRQ handler\r\n"

.section .text
.align 4
.globl security_function
security_function:
    .option push
    .option norelaxa
    la gp, __global_pointer$
    .option pop
    li t0, SPMADR
    lw sp, 0(t0)
    addi	sp,sp,-4
    sw ra, 0(sp)

    la a0, test_start_str
    call printf

    # wait 10 seconds
    la a0, 1
    call wait_seconds

    la a0, test_end_str
    call printf

    lw ra, 0(sp)

    addi	sp,sp,4

    ret

.align 4
.globl mtimer_irq_handler
mtimer_irq_handler:
    # .option push
    # .option norelax
    # la gp, __global_pointer$
    # .option pop

    la a0,test_handler_str
    call printf

    mret 